import { UserTypeEnum } from '@/common/constants'

export type PlainObject<T = any> = Record<string, T>

export interface IFaceItem {
  key: string
  img: string
}

export interface IChatMessageItem {
  from: UserTypeEnum
  id: string
  name: string
  avatar: string
  content: string
  read: boolean
  time: number | string
}

export interface IListItem<T = string> {
  label: string
  value: T
}

export type ISocketResponse<Data = string, EXTEND = {}> = {
  code: number
  data: Data
  msg: string
} & EXTEND

export type ISocketMessage = {
  init: ISocketResponse
  sso: ISocketResponse
  revokeMessage: ISocketResponse
  customerLink: ISocketResponse
  mentionNotice: ISocketResponse
  broadcastChatMessage: ISocketResponse
  chatMessage: ISocketResponse
  afterSend: ISocketResponse
  offline: ISocketResponse
  reLink: ISocketResponse
  reLinked: ISocketResponse
  readMessage: ISocketResponse
  removeQueue: ISocketResponse
  typing: ISocketResponse
  changeGroupCB: ISocketResponse
  linkKFCB: ISocketResponse
  praiseKfCB: ISocketResponse
  orderCallbackNotice: ISocketResponse
  certUploadCallbackNotice: ISocketResponse
  chatBotAnswer: ISocketResponse
  broadcastChatBotAnswer: ISocketResponse
  sendFrom: ISocketResponse
}

export interface IRegisterData {
  userId: string
  userType: UserTypeEnum
  merchantCode: string
}

export interface IUserData {
  userId: string
  userName: string
  userAvatar: string
}

export interface ISendSingleMessageData {
  fromUserId: string
  toUserId: string
  serviceId: string
  visitorId: string
  content: string
}
